//品牌管理
var exceptionStatus ='';
$(function(){


	$('#taskList').getList({
		"initData":{
			"num":1,
            "size":10,
            //"exceptionStatus":exceptionStatus
		},
		"url":site.apiUrl+"/back/task/selectExceptionTaskList",// 数据请求url
		"type": "get",
        "checkname":"datachk", //选择器名称，为空不显示选择器
        "ajaxform":true,
		"col":[  //数据列
			{"field":"taskName","display":"异常任务名称","width":"2"},
			{"field":"nickName","display":"申请人","width":"2"},
			{"field":"reasonsRevocationDisplay","display":"异常原因","width":"2"},
			{"field":"exceptionContext","display":"异常内容","width":"2"},
			{"field":"creatTime","display":"发布时间"}
		],
		"option":[ //操作按钮配置
			{"icon":"edit","tip":"处理","fun":"brandView('{{id}}')"},  //icon: view,edit,add,del
        //	{"icon":"edit","tip":"编辑","fun":"brandEdit('{{id}}')"},  // 花括号内可以对应相关字段
		//	{"icon":"del","tip":"删除","fun":"deleteBrand('{{id}}')"}
		]
	});


    $("input[name=handlerStatus]").click(function(){
         
         exceptionStatus = $(this).val()
    })
	//批量删除
	$("#batchDelBtn").click(function(){
		var c = "";
		$("input[name=datachk]:checked").each(function(){
			c += $(this).val()+',';
		});
		if(c!= null && c!=''){
			deleteBrand(c);
		}else{
			ly.toast("请选择删除项");
		}
		
	});
});
//编辑
function brandView(id){
	ly.goto("task-fail-creat.html?id="+id+"&attendanceType=2")
}
//删除
function deleteBrand(id){
	var url = site.gateUrl+"/back/task/deleteExceptionTaskByIds";
	ly.confirm("你确认删除吗？",function(){
		request({
			url:url,
			data:{"ids":id},
			type:"POST",
			'ajaxform':true,
			callback:function(f) {
				console.log(f);
				if(f.code=="rest.success"){
					ly.toast("删除成功");
					$("#taskList").getList.refresh();//刷新当前分页
				}else{
					ly.toast(f.desc);
				}
			}
		});	
	});
}